//*** Guidance generated code ***//
using System;
using System.Collections.Generic;
using System.Linq;

using ProjectBase.Core;

namespace $safeprojectname$.Services.HowTos
{
    /// <summary>
    /// Entity SimpleEntity.
    /// </summary>
    [Serializable]
    public class SimpleEntity : Persistent<string>
    {
        public virtual string NewID { get; set; }
        public override string ID
        {
            get
            {
                return base.ID.IsNotEmpty()
                      ? base.ID
                      : NewID;
            }
            protected set { base.ID = value; }
        }

        public virtual string NaturalKey { get; set; }
        public virtual string Description { get; set; }
        public virtual int RealValue { get; set; }
        public virtual bool IsVisible { get; set; }

        #region virtual, Complex managament
        public virtual IList<ComplexEntity> NewComplexAsync { get; set; }
        public virtual IList<ComplexEntity> NewComplexAuto { get; set; }
        public virtual IList<ComplexEntity> RemovedComplexAuto { get; set; }
        #endregion virtual, Complex managament

        #region override abstract
        /// <summary>
        /// Provides quick, string description about the 'SimpleEntity' instance
        /// </summary>
        public override string ToDisplay()
        {
            // This method is often used on View
            // there for provide clear and understandable
            // set of properties (separated by spaces ' ')
            // which will quickly provide information about this instance
            return NaturalKey;
        }

        /// <summary>
        /// Returned value should be handled as business unique key.
        /// Equal method (implemented in Tracked base class) will use it
        /// to compare two SimpleEntitys
        /// </summary>
        protected override string GetDomainObjectSignature()
        {
            // TODO return the property (or list of properties separated by "|")
            // which will allow to distinguish among entities
            return NaturalKey;
        }

        #endregion override abstract
    }
}


